﻿using System.ComponentModel.DataAnnotations;
using WI.CandidateManager.Common.Data.Enums;
using WI.CandidateManager.Common.Data.Properties;

namespace WI.CandidateManager.Common.Data.Entities
{
    
    internal interface ICandidate
    {
        [StringLength(60, MinimumLength = 10,
            ErrorMessageResourceName = "RequiredFullName",
            ErrorMessageResourceType = typeof(Resources))]
        string FullName { get; set; }

        [StringLength(20, MinimumLength = 8,
            ErrorMessageResourceName = "PasswordLength",
            ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        string PasswordText { get; set; }

        string ShortName { get; set; }

        [DataType(DataType.EmailAddress)]
        string Email { get; set; }

        [StringLength(20, MinimumLength = 5,
            ErrorMessageResourceName = "PhoneLength",
            ErrorMessageResourceType = typeof(Resources))]
        string Phone { get; set; }

        Gender Gender { get; set; }
    }
    
    [MetadataType(typeof(ICandidate))]
    public partial class Candidate : ICandidate
    {
        private string passwordText = Constants.InitialValueConstants.DefaultPassword;

        public string PasswordText
        {
            get { return passwordText; }
            set { passwordText = value; }
        }
    }
}
